<?php


namespace app\blog\model;


use app\common\BaseModel;

class MessageModel extends BaseModel
{
    protected $table = 'blog_admin_message';

    public function getUserEmailAttr($value, $data) {
        if($data['is_author']===0) {
            $userArr = explode('@', $value);
            $userName = $userArr[0];
            $hiddenLen = floor(strlen($userName)/2);
            $hiddenStr = buildSameStr(($hiddenLen+1));
            return substr($userName, 0, $hiddenLen).$hiddenStr.'@'.$userArr[1];
        }
        return $value;
    }
}